import React from 'react'
import {Router} from 'dva/router'
import App from './routes/app'


//import Teachers from "./routes/Teachers.js";

export default function ({history, app}) {
  const routes = [
    {
      path: '/',
      component: App,
      getIndexRoute (nextState, cb) {
        require.ensure([], require => {
          cb(null, {component: require('./routes/TeacherAttendanceRoute')})
        })
      },
      childRoutes: [
        {
          path: 'dashboard',
          name: 'dashboard',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              cb(null, require('./routes/TeacherAttendanceRoute'))
            })
          }
        },
        // {
        //   path: 'users',
        //   name: 'users',
        //   getComponent (nextState, cb) {
        //     require.ensure([], require => {
        //       cb(null, require('./routes/users'))
        //     })
        //   }
        // },
         {
          path: 'manage/teachers',
          name: 'manage/teachers',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              cb(null, require("./routes/Teachers.js"))
            })
          }
        },
         {
          path: 'teacher/attendance',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              cb(null, require("./routes/TeacherAttendanceRoute.js"))
            })
          }
        },

         {
          path: 'teacher/group',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              cb(null, require("./routes/TeacherGroup.js"))
            })
          }
         },
        // {
        //   path: 'ui/search',
        //   name: 'ui/search',
        //   getComponent (nextState, cb) {
        //     require.ensure([], require => {
        //       cb(null, require('./routes/ui/search'))
        //     })
        //   }
        // }, {
        //   path: '*',
        //   name: 'error',
        //   getComponent (nextState, cb) {
        //     require.ensure([], require => {
        //       cb(null, require('./routes/error'))
        //     })
        //   }
        // }
      ]
    }
  ]

  return <Router history={history} routes={routes} />
}
